package oj;

import java.util.*;

public class Day45S {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){
            int n=sc.nextInt();
            String[] s=new String[n];
            for(int i=0;i<n;i++){
                s[i]=sc.next();
            }

            String t=sc.next();
            int k=sc.nextInt();
            List<String> list=new ArrayList<>();
            int count=0;
            for(int i=0;i<n;i++){
                int c=isBrother(s[i],t);
                count+=c;
                if(c==1) list.add(s[i]);
            }
            Collections.sort(list);
            System.out.println(count);
            if(count>=k){
                System.out.println(list.get(k-1));
            }
        }
    }
    private static int isBrother(String r,String t){
        if(r.equals(t) || r.length()!=t.length()){
            return 0;
        }
        char[] rchar=r.toCharArray();
        char[] tchar=t.toCharArray();
        Arrays.sort(rchar);
        Arrays.sort(tchar);
        return Arrays.equals(rchar,tchar)?1:0;
    }
}
